package com.lazycat.backend.service.impl.cart;

import com.lazycat.backend.mapper.ShoppingCarMapper;
import com.lazycat.backend.pojo.UserShoppingCar;
import com.lazycat.backend.service.cart.AddToCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class AddToCartServiceImpl implements AddToCartService {

    @Autowired
    private ShoppingCarMapper shoppingCarMapper;

    @Override
    public Map<String, Object> add(Integer goodId, Integer userId) {
        HashMap<String, Object> resp = new HashMap<>();
        UserShoppingCar item = new UserShoppingCar(userId, goodId);
        shoppingCarMapper.insert(item);
        resp.put("error_message", "success");
        return resp;
    }
}
